package com.apollographql.apollo.api.internal;

import java.util.Collections;
import java.util.Set;

/* access modifiers changed from: package-private */
public final class Present<T> extends Optional<T> {
    private static final long serialVersionUID = 0;
    private final T reference;

    Present(T reference2) {
        this.reference = reference2;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public boolean isPresent() {
        return true;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public T get() {
        return this.reference;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public T or(T defaultValue) {
        return this.reference;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public Optional<T> or(Optional<? extends T> secondChoice) {
        return this;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public <V> Optional<V> transform(Function<? super T, V> function) {
        return new Present(function.apply(this.reference));
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public <V> Optional<V> map(Function<? super T, V> function) {
        return new Present(function.apply(this.reference));
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public <V> Optional<V> flatMap(Function<? super T, Optional<V>> function) {
        return (Optional) function.apply(this.reference);
    }

    /* JADX DEBUG: Type inference failed for r0v1. Raw type applied. Possible types: com.apollographql.apollo.api.internal.Optional<V>, com.apollographql.apollo.api.internal.Optional<T> */
    @Override // com.apollographql.apollo.api.internal.Optional
    public Optional<T> apply(final Action<T> action) {
        return (Optional<T>) map(new Function<T, T>() {
            /* class com.apollographql.apollo.api.internal.Present.AnonymousClass1 */

            @Override // com.apollographql.apollo.api.internal.Function
            public T apply(T t) {
                action.apply(t);
                return t;
            }
        });
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public T orNull() {
        return this.reference;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public Set<T> asSet() {
        return Collections.singleton(this.reference);
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public boolean equals(Object object) {
        if (object instanceof Present) {
            return this.reference.equals(((Present) object).reference);
        }
        return false;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public int hashCode() {
        return this.reference.hashCode() + 1502476572;
    }

    @Override // com.apollographql.apollo.api.internal.Optional
    public String toString() {
        return "Optional.of(" + ((Object) this.reference) + ")";
    }
}
